﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace SecureCommander.GUI
{
    /// <summary>
    /// Interaction logic for FormCreatePassword.xaml
    /// </summary>
    public partial class FormCreatePassword : Window
    {
        public FormCreatePassword()
        {
            InitializeComponent();
        }

        public string Password { get; set; }

        private void btnOK_Click(object sender, RoutedEventArgs e)
        {
            e.Handled = true;
            if (txtPassword.Password == null && txtPassword.Password.Trim() == "")
            {
                MessageBox.Show("Password can't empty!", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }

            if (txtPassword.Password != txtRePassword.Password)
            {
                MessageBox.Show("Password retype not match! Try again!", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }    

            Password = txtPassword.Password;
            DialogResult = true;
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            txtPassword.Focus();
        }
    }
}
